/* $RCSFile: ADNDynPriceLevel.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynPriceLevel.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
	public class ADNDynPricelevel : DynEntity
	{
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.pricelevel)
            {}

            public override Type DynType
            { get { return typeof(ADNDynPricelevel); } }

            public override string DynTypename
            {   get{ return CrmStr.pricelevel;}}

            public override DynEntity Build()
            {   return new ADNDynPricelevel();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynPricelevel(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynPricelevel(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynPricelevel(w,PrimaryKeyValue);}
        }

        static ADNDynPricelevel(){new Ftor();} 

        public override bool HasOwnerProperty
        {
            get{   return false;}
        }

        public override bool HasBusinessUnitProperty
        {
            get{   return false;}
        }

        /// <summary>
		/// Reserved for template methods: do not use directly
		/// </summary>
        public ADNDynPricelevel(): base()
		{}

        public ADNDynPricelevel(ResetWrapperHandler fn,string PrimaryFiedlValue)
			: base(fn,CrmStr.pricelevel)
		{
			name    =  PrimaryFiedlValue;
		}

        public ADNDynPricelevel(CRMWrapperBase w, string PrimaryFiedlValue)
			: base(w,CrmStr.pricelevel)
		{
			name    =  PrimaryFiedlValue;
		}

        public ADNDynPricelevel(CRMWrapperBase w, Guid CrmId)
			: base(w,CrmStr.pricelevel, CrmId)
		{}

		public ADNDynPricelevel(ResetWrapperHandler fn,Guid CrmId)
			: base(fn,CrmStr.pricelevel, CrmId)
		{}

		public ADNDynPricelevel(ResetWrapperHandler fn,InternalDynamicEntity e)
			: base(fn,CrmStr.pricelevel,e,null,null)
		{}

		public ADNDynPricelevel(CRMWrapperBase w, InternalDynamicEntity e)
			: base(w,CrmStr.pricelevel,e,null,null)
		{}

		public ADNDynPricelevel(CRMWrapperBase w, InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(w,CrmStr.pricelevel,e,prop,s)
		{}

		public ADNDynPricelevel(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(fn,CrmStr.pricelevel,e,prop,s)
		{}


        [CrmDynAttribute(CrmStr.pricelevel)]
		public Guid pricelevelid
		{
			get
			{
				return KeyPropertyValue(CrmStr.pricelevelid);
			}
			set
			{
				AddKeyProperty(CrmStr.pricelevelid, value);
			}
		}

        protected override void SetCrmIdProperty(Guid crmId)
        {
           if ( !dicProperty.ContainsKey(CrmStr.pricelevelid) || KeyPropertyValue(CrmStr.pricelevelid) != crmId )
                pricelevelid    =   crmId;
        }

        public override Guid PrimaryKeyGuidValue
        {
           get
           {
                return pricelevelid;
           }
           set
           {
               pricelevelid    =   value;
           }
        }

        [CrmDynAttribute(CrmStr.pricelevel)]
        public Guid transactioncurrencyid
        {
            get
            {
                return LookupPropertyValue(CrmStr.transactioncurrencyid);
            }
            set
            {
                AddLookupProperty(CrmStr.transactioncurrencyid,CrmStr.transactioncurrency,value);
            }
        }
        
        public string transactioncurrencyName
        {
            get
            {
                return LookupPropertyName(CrmStr.transactioncurrencyid);
            }
        }
        
        /// <summary>
        /// Gets or sets the date on which the price list becomes effective. 
        /// </summary>
        [CrmDynAttribute(CrmStr.pricelevel)]
        public string begindate
        {
            get
            {
                return DateTimePropertyValue(CrmStr.begindate);
            }
            set
            {
                AddDateTimeProperty(CrmStr.begindate,value);
            }
        }

        /// <summary>
        /// Gets or sets the date that is the last day the price list is valid. 
        /// </summary>
        [CrmDynAttribute(CrmStr.pricelevel)]
        public string enddate
        {
            get
            {
                return DateTimePropertyValue(CrmStr.enddate);
            }
            set
            {
                AddDateTimeProperty(CrmStr.enddate,value);
            }
        }

        [CrmDynAttribute(CrmStr.pricelevel)]
        public string description
        {
            get
            {
                return StringPropertyValue(CrmStr.description);
            }
            set
            {
                AddStringProperty(CrmStr.description,value);
            }
        }

        /// <summary>
        /// Gets or sets the freight terms for the price list. 
        /// </summary>
        [CrmDynAttribute(CrmStr.pricelevel)]
        public int freighttermscode
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.freighttermscode);
            }
            set
            {
                AddPicklistProperty(CrmStr.freighttermscode,value);
            }
        }

        public string freighttermscodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.freighttermscode);
            }
        }
        
        /// <summary>
        /// Gets or sets the payment terms to use with the price list. 
        /// </summary>
        [CrmDynAttribute(CrmStr.pricelevel)]
        public int paymentmethodcode
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.paymentmethodcode);
            }
            set
            {
                AddPicklistProperty(CrmStr.paymentmethodcode,value);
            }
        }

        public string paymentmethodcodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.paymentmethodcode);
            }
        }

        /// <summary>
        /// Gets or sets the method of shipment for products in the price list. 
        /// </summary>
        [CrmDynAttribute(CrmStr.pricelevel)]
        public int shippingmethodcode
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.shippingmethodcode);
            }
            set
            {
                AddPicklistProperty(CrmStr.shippingmethodcode,value);
            }
        }
        public string shippingmethodcodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.shippingmethodcode);
            }
        }
    }
}
